<template>
  <div class="app-container">
     <el-form ref="form" :model="form" :rules="rules" label-width="120px">
       <el-row :gutter="10">{{navigator}}
        <div style="padding:15px;"><span>基本信息</span> <span   style="padding-left:40px"><el-button 
        
              v-if="request!=2"
              type="info"
              plain
              icon="el-icon-upload2"
              size="mini"
            
              @click="handleImport"
            >批量导入</el-button></span></div>
        
        <el-form-item label="单位名称" prop="companyName">
          <el-input v-model="form.companyName" placeholder="请输入单位名称" />
        </el-form-item>
         <el-form-item label="单位类型" prop="companyType">
           <el-select
          v-model="form.companyType"
          placeholder="请输入单位类型"
          clearable
          style="width: 100%"
          >
          <el-option
            v-for="dict in dict.type.work_compay_type"
            :key="dict.label"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
        
        </el-form-item>
        <el-form-item label="单位所在地区" prop="areas">
          <el-cascader  
          :props="{label:'name',value: 'areaCode'}"
          v-model="form.areas" :options="areaOptions"  style="width: 100%" placeholder="请输入单位所在地区" clearable></el-cascader>
        </el-form-item>
       </el-row>
       <el-row :gutter="10">
       <div style="padding:15px;"><span><a @click="handleList(1)" style="cursor:hand">2024年计划招聘人数</a></span>
   
       </div>
         <el-form-item label="第一步">
            填写招聘计划
        </el-form-item>

        <el-form-item label="招聘人数" prop="currentPostCount">
          <el-input v-model="form.currentPostCount"   placeholder="请输入2024年计划招聘人数" />
        </el-form-item>

        <el-form-item label="编内人数" prop="currentInnerCount">
          <el-input v-model="form.currentInnerCount"  placeholder="无编内岗位填0" />
        </el-form-item>
         <el-form-item label="第二步">填写招聘岗位<br/>    
             <span><el-link icon="el-icon-edit" type="primary" @click="handleAdd(1)" >添加招聘专业及人数</el-link></span>
            <span><el-link icon="el-icon-view" type="primary" style="padding-left:10px;" @click="handleList(1)">查看已添加</el-link></span>
        </el-form-item>
        </el-row>
       <el-row :gutter="10">
        <div style="padding:15px;"><span><a @click="handleList(2)" style="cursor:hand">2025年计划招聘人数</a></span>

        </div>
         <el-form-item label="第一步">
            填写招聘计划
        </el-form-item>
        <el-form-item label="招聘人数" prop="nextPostCount">
          <el-input v-model="form.nextPostCount"  placeholder="请输入2025年计划招聘人数" />
        </el-form-item>
        <el-form-item label="编内人数" prop="nextInnerCount">
          <el-input v-model="form.nextInnerCount" placeholder="无编内岗位填0" />
        </el-form-item>
        <el-form-item label="第二步">
        填写招聘岗位<br/>          
        <span><el-link icon="el-icon-edit" type="primary" @click="handleAdd(2)">添加招聘专业及人数</el-link></span>
         <span><el-link icon="el-icon-view" type="primary" style="padding-left:10px;" @click="handleList(2)">查看已添加</el-link></span>
        </el-form-item>
        
       </el-row>
       <el-row :gutter="10">
        <div style="padding:15px;"><span><a @click="handleList(3)" style="cursor:hand">2026至2029年计划招聘人数</a></span>
     
        </div>
        <el-form-item label="第一步">
            填写招聘计划
        </el-form-item>
        
         <el-form-item label="招聘人数" prop="nextPostCount">
          <el-input v-model="form.futurePostCount" placeholder="2026至2029年计划招聘人数" />
        </el-form-item>
        <el-form-item label="编内人数" prop="futureInnerCount">
          <el-input v-model="form.futureInnerCount" placeholder="无编内岗位填0" />
        </el-form-item> 
        <el-form-item label="第二步">填写招聘岗位<br/>
         <span><el-link icon="el-icon-edit" type="primary" @click="handleAdd(3)">添加招聘专业及人数</el-link></span>
        <span><el-link icon="el-icon-view" type="primary" @click="handleList(3)">查看已添加</el-link></span>
        </el-form-item>
        
        </el-row>
        
        <el-row type="flex"  :gutter="10" justify="center">   
          <el-col :span="1.5">
            <el-button v-if="newAddTitleBtn" type="primary" @click="submitForm" style="width:120px">保存岗位需求</el-button>
            <el-button v-if="!newAddTitleBtn" type="primary" @click="handleAddTitle" style="width:120px">继续添加岗位</el-button>
            <el-button @click="cancel1" style="width:120px">返 回</el-button>
          </el-col>
         </el-row>
      </el-form>
      

    <!-- 添加或修改招聘信息对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="380px" append-to-body>
      <el-form ref="positionForm" :model="positionForm" :rules="rules1" label-width="90px">
        <el-form-item label="学历要求" prop="educationaRequirement">
         <el-select
          v-model="positionForm.educationaRequirement"
          placeholder="请输入学历要求"
          clearable
          style="width: 100%"
          >
          <el-option
            v-for="dict in dict.type.work_educationa_requirement"
            :key="dict.label"
            :label="dict.label"
            :value="dict.label"
          />
        </el-select>
        
        </el-form-item>
        <el-form-item label="专业要求" prop="professions">
           <el-cascader  
          :props="{label:'professionName',value: 'professionCode'}"
          v-model="positionForm.professions" :options="professionOptions"  style="width: 100%" placeholder="请输入专业" clearable></el-cascader>
        </el-form-item>
        <el-form-item label="招聘人数" prop="workCount">
          <el-input v-model="positionForm.workCount" placeholder="招聘人数" />
        </el-form-item>
        <el-form-item v-if="positionForm.planType==1" label="已招聘人数" prop="hasCount">
          <el-input v-model="positionForm.hasCount" placeholder="请输已招聘人数" />
        </el-form-item>
        <el-form-item label="备注" prop="remark">
          <el-input v-model="positionForm.remark" placeholder="请输入备注" />
        </el-form-item>
      </el-form>
      <el-row type="flex"  :gutter="10" justify="center">   
          <el-col :span="1.5">
        <el-button v-if="newAddPositonBtn" type="primary" @click="submitForm1">保存专业要求</el-button>
        <el-button v-if="!newAddPositonBtn" type="primary" @click="handleAdd1">继续添加专业</el-button>
        <el-button @click="cancel">添加完成返回</el-button>
             </el-col>
         </el-row>
    </el-dialog>
    
    
     <!-- 添加或修改招聘信息对话框 -->
    <el-dialog :title="title" :visible.sync="openList" width="380px" append-to-body>
     <el-table v-if="positionForm.planType==1" :data="form.positionList1">
      <el-table-column label="学历要求" align="center" prop="educationaRequirement" />
      <el-table-column label="专业" align="center" prop="professionName" />
      <el-table-column label="招聘数量" align="center" prop="workCount" />
      <el-table-column label="已招数量" align="center" prop="hasCount" />
      <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
          ></el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
          ></el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <el-table v-if="positionForm.planType==2" :data="form.positionList2">
      <el-table-column label="学历要求" align="center" prop="educationaRequirement" />
      <el-table-column label="专业" align="center" prop="professionName" />
      <el-table-column label="招聘数量" align="center" prop="workCount" />
      <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
          ></el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
          ></el-button>
        </template>
      </el-table-column>
    </el-table>
    
    <el-table v-if="positionForm.planType==3" :data="form.positionList3">
      <el-table-column label="学历要求" align="center" prop="educationaRequirement" />
      <el-table-column label="专业" align="center" prop="professionName" />
      <el-table-column label="招聘数量" align="center" prop="workCount" />
      <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
          ></el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
          ></el-button>
        </template>
      </el-table-column>
    </el-table>
      <el-row type="flex"  :gutter="10" justify="center">   
          <el-col :span="1.5">
          <br/>
        <el-button @click="cancel2">返 回</el-button>
             </el-col>
         </el-row>
    </el-dialog>
    
    
    <!-- 用户导入对话框 -->
    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
      <el-upload
        ref="upload"
        :limit="1"
        accept=".xlsx, .xls"
        :headers="upload.headers"
        :action="upload.url + '?updateSupport=' + upload.updateSupport"
        :disabled="upload.isUploading"
        :on-progress="handleFileUploadProgress"
        :on-success="handleFileSuccess"
        :auto-upload="false"
        drag
      >
        <i class="el-icon-upload"></i>
        <div class="el-upload__text">将文件拖到此处，或<em>点击上传</em></div>
        <div class="el-upload__tip text-center" slot="tip">

          <span>仅允许导入xls、xlsx格式文件。</span>
          <el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" href="../template_V2.xlsx" target="blank">下载模板</el-link>
        </div>
      </el-upload>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitFileForm">确 定</el-button>
        <el-button @click="upload.open = false">取 消</el-button>
      </div>
    </el-dialog>
    
  </div>
</template>

<script>
import { listTitle, getTitle, delTitle, addTitle, updateTitle } from "@/api/system/title";
import { listAreaTree } from "@/api/work/area/area.js";
import { listProfessionTree} from "@/api/work/profession/profession.js";
import { listProfession} from "@/api/work/profession/profession.js";
import { listPosition, getPosition, delPosition, addPosition, updatePosition } from "@/api/system/position";
import { getArrayData,removeArrayData } from '@/utils/index.js';
import { getToken } from "@/utils/auth";

export default {
  name: "Title",
  dicts: ['work_compay_type','work_educationa_requirement'],
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 招聘信息表格数据
      titleList: [],
      // 招聘计划表格数据
      positionList1: [],
      positionList2: [],
      positionList3: [],
      
      lable1:"",
      lable2:"",
      lable3:"",
      lableplan1:"",
      lableplan2:"",
      lableplan3:"",      
      lableinner1:"",
      lableinner2:"",
      lableinner3:"",
      request:1,
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      openList: false,
      newAddTitleBtn:true,
      newAddPositonBtn:true,
      currentYear: new Date().getFullYear(),
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        companyName: null,
        companyType: null,
        area: null,
        status: null,
        prvePostCount: null,
        currentPostCount: null,
        nextPostCount: null,
        year: null,
      },
      // 表单参数
      form: {  
        employId: null,
        companyName: null,
        companyType: null,
        areas: ["zhinan", "shejiyuanze", "yizhi"],
        status: null,
        currentPostCount: null,
        currentInnerCount: null,
        nextPostCount: null,
        nextInnerCount: null,
        futurePostCount: null,
        futureInnerCount: null,
        year: this.currentYear,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null,
        positionList1: [],
        positionList2: [],
        positionList3: []
        },
        
      positionForm:{
        positionId: null,
        employId: null,
        positionYear: null,
        planType: 1,
        positonName: null,
        educationaRequirement: null,
        profession: null,
        professions: null,
        workCount: null,
        hasCount: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      },
      areaOptions: [],
      professionOptions:[],
      professionList:[],
      upload: {
        // 是否显示弹出层（用户导入）
        open: false,
        // 弹出层标题（用户导入）
        title: "",
        // 是否禁用上传
        isUploading: false,
        // 是否更新已经存在的用户数据
        updateSupport: 0,
        // 设置上传的请求头部
        // 上传的地址
        url: process.env.VUE_APP_BASE_API + "/system/title/importData"
      },
      // 表单校验
      rules: {
        companyName: [
          { required: true, message: "单位名称不能为空", trigger: "blur" }
        ],
        companyType: [
          { required: true, message: "单位类型不能为空", trigger: "change" }
        ],
        areas: [
          { required: true, message: "单位所在地区不能为空", trigger: "change" }
        ],
         currentPostCount: [
          { required: true, message: "招聘人数不能为空", trigger: "change" }
        ],
        currentInnerCount: [
          { required: true, message: "招聘人数不能为空", trigger: "change" }
        ],
         nextPostCount: [
          { required: true, message: "招聘人数不能为空", trigger: "change" }
        ],
        nextInnerCount: [
          { required: true, message: "招聘人数不能为空", trigger: "change" }
        ],
         futurePostCount: [
          { required: true, message: "招聘人数不能为空", trigger: "change" }
        ],
        futureInnerCount: [
          { required: true, message: "招聘人数不能为空", trigger: "change" }
        ],
      },
      rules1: {
        educationaRequirement: [
          { required: true, message: "学历要求不能为空", trigger: "change" }
        ],
        professions: [
          { required: true, message: "单位类型不能为空", trigger: "change" }
        ],
        workCount: [
          { required: true, message: "单位所在地区不能为空", trigger: "change" }
        ],
      }
    };
  },
  created() {
    this.initData();
    
  },
   watch: {
     '$route' (to, from) {
	     if(to.name == this.$options.name){
	
		 }
		 this.initData();
      }
  },
  methods: {
    initData(){
       this.request = this.$route.query.request;
       this.newAddTitleBtn=true;
       this.lable1=this.form.year+"年计划招聘人数",
       this.lable2=(parseInt(this.form.year)+1)+"年计划招聘人数",
       this.lable3=(parseInt(this.form.year)+2)+"至"+(parseInt(this.form.year)+5)+"年计划招聘人数",
      
      
       this.handleDetail();
       if(!this.isMobile()){
        this.request=1;
       }
       this.handleListAreaTree();
       this.handleListProfessionTree();
     //  this.handleUpdate(null);
       this.getPositionList();
    },
    
    isMobile() {
       let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)
         return flag;
     },
    /** 查询招聘信息列表 */
    getList() {
      this.loading = true;
      listTitle(this.queryParams).then(response => {
        this.titleList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    
    getPositionList() {
      this.loading = true;
      listPosition(this.queryParams).then(response => {
        this.positionList1 = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
  
    cancel1() {
      if(this.request == 2){
          window.location.href="../work/listWork?request=2&companyName="+this.form.companyName
            //this.$router.push("/work/addWork?request=2&companyName="+this.form.companyName);
          // window.location.href="https://www.fj99.org.cn/"
         
      }
      else if(this.request == 1){
         ///  window.location.href="../work/listWork?request=2"
          window.location.href="../work/listWork?request=1&companyName="+this.form.companyName
        //  window.location.href="https://www.fj99.org.cn/"
         
      }else{
          this.$router.push("/work/title");
       }
    },
    
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset1();
    },
    
   cancel2() {
      this.openList = false;
    },
    
    
    // 表单重置
    reset() {
    
      var name =this.form.companyName;
      this.form = {
        employId: null,
        companyName: null,
        companyType: null,
        areas: [],
        positionList1: [],
        positionList2: [],
        positionList3: [],
        status: null,
        currentPostCount: null,
        currentInnerCount: null,
        nextPostCount: null,
        nextInnerCount: null,
        futurePostCount: null,
        futureInnerCount: null,
        year: this.currentYear,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      };
      this.resetForm("form");
      this.form.companyName=name;
    },
    reset1() {
      var planType =this.positionForm.planType;
      this.positionForm = {
        positionId: null,
        employId: null,
        positionYear: null,
        planType: planType,
        positonName: null,
        educationaRequirement: null,
        profession: null,
        workCount: null,
        hasCount: null,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      };
      this.resetForm("positionForm");
    },
    
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.employId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    handleAddTitle() {
       this.newAddTitleBtn=true;
     
       this.reset();
    },
    
    /** 新增按钮操作 */
    handleAdd(type) {
      this.reset1();
      this.positionForm.planType=type;
      this.newAddPositonBtn=true;
      this.open = true;
      this.handleName(type);
     // this.title = "添加岗位专业【"++"】";
      //this.lable1="添加"+this.form.year+"年计划招聘人数",
      //this.lable2="添加"+(parseInt(this.form.year)+1)+"年计划招聘人数",
      //this.lable3="添加"+(parseInt(this.form.year)+2)+"至"+(parseInt(this.queryParams.year)+5)+"年计划招聘",
      
      
      //this.title = lable1;
    },
      handleName(type) {

      let count1=this.form.positionList1.length+1;
      let count2=this.form.positionList2.length+1;
      let count3=this.form.positionList3.length+1;
      if(this.positionForm.planType==1){
         this.title = "添加第【"+count1+"】岗位专业";
      }
      if(this.positionForm.planType==2){
           this.title = "添加第【"+count2+"】岗位专业";
      }
      if(this.positionForm.planType==3){
           this.title = "添加第【"+count3+"】岗位专业";
      }
    },
    
     handleAdd1() {
      this.reset1();
      this.newAddPositonBtn=true;
    },
    
    handleList(type) {
      this.positionForm.planType=type;
      this.$forceUpdate();
      this.open = false;
      this.openList=true;
      this.title = "招聘专业列表";
    },
    
      /** 修改按钮操作 */
    async handleDetail() {
       this.reset();
       let employId = this.$route.query.employId;
       let companyName = this.$route.query.companyName;
       this.form.companyName = companyName;
      
       if(employId){	       
	       //const employId = row.employId || this.ids
	       var res1 = await getTitle(employId);
	       this.form = res1.data;

       }
       
       this.lable1=this.form.year+"年计划招聘人数",
       this.lable2=(parseInt(this.form.year)+1)+"年计划招聘人数",
       this.lable3=(parseInt(this.form.year)+2)+"至"+(parseInt(this.form.year)+5)+"年计划招聘人数",
    
        this.form.employId = employId;
    },
    
    /** 修改按钮操作 */
    async handleUpdate(row) {
      Object.assign(this.positionForm, row);
      this.newAddPositonBtn=true;
      this.open = true;
    },
    
    /** 修改按钮操作 */
    async handleListAreaTree() {
       var param = {
        parentCode:'0',
        name:'福建省'
       }
       
       var res = await listAreaTree(param);
       this.areaOptions = res.data;
    },
   
   /** 修改按钮操作 */
    async handleListProfessionTree() {
       var param = {
        parentCode:'0',
       }
       
       var res = await listProfessionTree(param);
       this.professionOptions = res.data;
       var res1 = await listProfession({pageSize:10000});
       this.professionList = res1.rows;
    },
    
    
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          let count1=this.getPositionCount(this.form.positionList1);
          
          let count2=this.getPositionCount(this.form.positionList2);
          let count3=this.getPositionCount(this.form.positionList3);
          if(count1 !=this.form.currentPostCount){  
            this.$modal.msgError(this.form.year+"年计划招聘人数输入不一致！");
            return;
          }
          if(count2 !=this.form.nextPostCount){  
           this.$modal.msgError((parseInt(this.form.year)+1)+"年计划招聘人数输入不一致！");
           return;
          }
          if(count3 !=this.form.futurePostCount){  
           this.$modal.msgError((parseInt(this.form.year)+2)+"至"+(parseInt(this.form.year)+5)+"年计划招聘人数输入不一致！");
           return;
          }
          
          
          if (this.form.employId != null) {
            updateTitle(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.handleAddTitle();
              //this.newAddTitleBtn=false;
            });
          } else {
              addTitle(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.form.employId=response.data.employId;
              //this.newAddTitleBtn=false;
                   this.handleAddTitle();
            });
          }
        }
      });
    },
    
    getPositionCount(positionList){
      let count=0;
      for(var i=0;i<positionList.length;i++){
         count = count + parseInt(positionList[i].workCount);
      }
      return count;
      
    },
    
     
    /** 提交按钮 */
    submitForm1() {
      this.$refs["positionForm"].validate(valid => {
          let data = {};

          
          Object.assign(data, this.positionForm);
          data.positionId= "id"+ Math.random();
               console.log( this.positionForm);
          var profession = this.positionForm.professions[1];
     
          var dist = getArrayData(this.professionList,'professionCode',profession);
          console.log( this.positionForm);
          data.professionName = dist.professionName;
          
          if(this.positionForm.planType == 1){
               let newArray = removeArrayData(this.form.positionList1,"positionId",this.positionForm.positionId);
               newArray.push(data);
               this.form.positionList1 = newArray;
      	  }
	      if(this.positionForm.planType == 2){
	        let newArray = removeArrayData(this.form.positionList2,"positionId",this.positionForm.positionId);
            newArray.push(data);
	        this.form.positionList2 = newArray;
	      }
	      if(this.positionForm.planType == 3){
	      	  let newArray = removeArrayData(this.form.positionList3,"positionId",this.positionForm.positionId);
              newArray.push(data);
	         this.form.positionList3 = newArray;
	      }
	      //this.newAddPositonBtn=false;
	      this.reset1();
	      this.$modal.msgSuccess("新增成功");
		  this.$forceUpdate();
		  this.handleName(this.positionForm.planType);
      });
    },
    
    /** 删除按钮操作 */
    handleDelete(row) {
      if(this.positionForm.planType == 1){
         let newArray=  removeArrayData(this.form.positionList1,"positionId",row.positionId);
         this.form.positionList1 = newArray;
      }
      if(this.positionForm.planType == 2){
         let newArray=  removeArrayData(this.form.positionList2,"positionId",row.positionId);
         this.form.positionList2 = newArray;
      }
      if(this.positionForm.planType == 3){
         let newArray=  removeArrayData(this.form.positionList3,"positionId",row.positionId);
         this.form.positionList3 = newArray;
      }
      
	  this.$forceUpdate();
    },
    
       /** 导入按钮操作 */
    handleImport() {
      this.upload.title = "用户导入";
      this.upload.open = true;
    },
    /** 下载模板操作 */
    importTemplate() {
      this.download('system/title/importTemplate', {
      }, `work_template_${new Date().getTime()}.xlsx`)
    },
    // 文件上传中处理
    handleFileUploadProgress(event, file, fileList) {
      this.upload.isUploading = true;
    },
    // 文件上传成功处理
    handleFileSuccess(response, file, fileList) {
      this.upload.open = false;
      this.upload.isUploading = false;
      this.$refs.upload.clearFiles();
      this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", { dangerouslyUseHTMLString: true });
      this.getList();
    },
    // 提交上传文件
    submitFileForm() {
      this.$refs.upload.submit();
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/title/export', {
        ...this.queryParams
      }, `title_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
